home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / squareSrfToolScript.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.9 KB  |  167 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  14 January 1999
  22. // Author:         sw
  23. //
  24. //
  25. //  Procedure Name:
  26. //      squareSrfToolScript
  27. //
  28. //  Description:
  29. //    create wrapper around the squareSrf command
  30. //
  31. //  Input Arguments:
  32. //        0 ==> do the command.
  33. //        1 ==> show the action option box
  34. //        2 ==> return the command
  35. //        3 ==> show tool option box
  36. //        4 ==> enter the tool
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41.  
  42. global proc squareSrfValues ( string $toolName ) 
  43. {
  44.     performSquareSrf 3 $toolName;
  45.     scriptCtxCommonValues( $toolName );
  46. }
  47.  
  48. global proc squareSrfProperties()
  49. {
  50.     scriptCtxCommonProperties;
  51. }
  52.  
  53. global proc squareSrf4curves( int $ncurves, string $goToTool )
  54. {
  55.     scriptCtx -e -ssc $ncurves $goToTool;
  56.     if( 4 == $ncurves ) {
  57.         scriptCtx -e
  58.           -setNoSelectionPrompt ("Select 4 curve(s), isoparm(s) " +
  59.                                  "or trim edges forming a " +
  60.                                  "closed region).")
  61.           -setSelectionPrompt ("Select 4 curves, isoparms or trim " +
  62.                                "edges forming a closed region; " +
  63.                                "press ENTER to compute square surface.")
  64.           -setSelectionCount 4
  65.           $goToTool;
  66.     }
  67.     else if( 3 == $ncurves ) {
  68.         scriptCtx -e
  69.           -setNoSelectionPrompt ("Select 3 curve(s), isoparm(s) " +
  70.                                  "or trim edges forming a " +
  71.                                  "closed region).")
  72.           -setSelectionPrompt ("Select 3 curves, isoparms or trim " +
  73.                                "edges forming a closed region; " +
  74.                                "press ENTER to compute square surface.")
  75.           -setSelectionCount 3
  76.           $goToTool;
  77.     }
  78.     else {
  79.         scriptCtx -e
  80.           -setNoSelectionPrompt ("Select 3 or 4 curve(s), isoparm(s) " +
  81.                                  "or trim edges forming a " +
  82.                                  "closed region).")
  83.           -setSelectionPrompt ("Select 3 or 4 curves, isoparms or trim " +
  84.                                "edges forming a closed region; " +
  85.                                "press ENTER to compute square surface.")
  86.           -setSelectionCount 0
  87.           $goToTool;
  88.     }
  89. }
  90.  
  91. global proc squareSrfToolSetup( int $forceFactorySettings, string $goToTool )
  92. {
  93.     if( $forceFactorySettings || !`optionVar -ex closeSurfaceEuc` ) {
  94.         optionVar -iv squareSurfaceEuc 0;
  95.     }
  96.     if( $forceFactorySettings || !`optionVar -ex squareSurfaceLac` ) {
  97.         optionVar -iv squareSurfaceLac 1;
  98.     }
  99.     if( "" != $goToTool ) {
  100.         scriptCtx -e -euc `optionVar -q squareSurfaceEuc` $goToTool;
  101.         scriptCtx -e -lac `optionVar -q squareSurfaceLac` $goToTool;
  102.         squareSrf4curves `optionVar -q squareSrfAutoEdgeCount` $goToTool;
  103.     }
  104. }
  105.  
  106. global proc squareSrfAutoComplete( int $val, string $goToTool )
  107. {
  108.     scriptCtx -e -lac $val $goToTool;
  109.     squareSrf4curves `optionVar -q squareSrfAutoEdgeCount` $goToTool;
  110. }
  111.  
  112. proc createSquareSrfContext( string $tool )
  113. {
  114.     if( ! `scriptCtx -exists $tool` ) {
  115.         squareSrfToolSetup( 0, "" );
  116.         scriptCtx -i1 "squareSrf.xpm"
  117.           -title "Square Surface Tool"
  118.           -bcn "squareSrf"
  119.  
  120.           -exitUponCompletion `optionVar -q squareSurfaceEuc`
  121.           -totalSelectionSets 1
  122.           -expandSelectionList true
  123.           -fcs ("squareSrfToolScript 0")
  124.  
  125.           -setNoSelectionPrompt ("Select 3 or 4 curve(s), isoparm(s) " +
  126.                                  "or trim edges forming a " +
  127.                                  "closed region).")
  128.           -setSelectionPrompt ("Select 3 or 4 curves, isoparms or trim " +
  129.                                "edges forming a closed region; " +
  130.                                "press ENTER to compute square surface.")
  131.  
  132.           -setAutoToggleSelection true
  133.           -setAutoComplete `optionVar -q squareSurfaceLac`
  134.           -showManipulators true
  135.  
  136.           -setSelectionCount 4
  137.           -nurbsCurve true
  138.           -isoparm true
  139.           -curveOnSurface true
  140.           -surfaceEdge true
  141.           -polymeshEdge true
  142.         $tool;
  143.     }
  144. }
  145.  
  146. global proc string squareSrfToolScript( int $setToTool )
  147. //
  148. //    Description :
  149. //        0 ==> do the command.
  150. //        1 ==> show the action option box
  151. //        2 ==> return the command
  152. //        3 ==> show tool/action option box
  153. //        4 ==> enter the tool/do the command
  154. {
  155.     string $tool = "";
  156.     if( $setToTool > 2 ) {
  157.         if( !`optionVar -q modelWithToolSquareSrf` ) {
  158.             $setToTool = 4 - $setToTool;
  159.         }
  160.         else {
  161.             $tool = "squareSrfContext";
  162.             createSquareSrfContext $tool;
  163.         }
  164.     }
  165.     return scriptToolScript( "performSquareSrf", $setToTool, $tool );
  166. }
  167.